<?php
/**
 * @file ArtistInsideSecrecy.php
 * @author CaoQiCheng
 * @date 2016年6月26日 下午17:05:11
 * @brief 
 */
namespace haibao\cms\business\artist;

use haibao\cms\data\artist\ArtistInsideSecrecy as ArtistInsideSecrecyData;
use haibao\app\business\BusinessException;
use haibao\cms\model\filter\artist\ArtistInsideSecrecy as ArtistInsideSecrecyFilter;
use haibao\frame\data\query\Condition;

class ArtistInsideSecrecy extends \haibao\cms\business\Base{
	/**
	 * 取得单个信息
	 */
	public static function getOne($query){
		$data = new ArtistInsideSecrecyData();
		return $data->getOne($query);
	}
	
	/**
	 * 取得多个信息
	 */
	public static function getAll($query){
		$data = new ArtistInsideSecrecyData();
		return $data->getAll($query);
	}
	
	/**
	 * 存储保密艺人信息
	 */
	public static function saveArtistInsideSecrecy($artistInsideModel,$isEdit=false){
		$funcCode = $isEdit ? self::FUNC_CODE_ARTISTSECRECY_EDIT : self::FUNC_CODE_ARTISTSECRECY_ADD;
		self::checkOperation($funcCode);

		if(!$artistInsideModel->ArtistId){
			return false;
		}
		if(!$artistInsideModel->ArtistType){
			return false;
		}

		if(!$artistInsideModel->Id){
			$artistInsideModel->CreateTime  = new \DateTime();
			$artistInsideModel->CreateBy = self::getCurrentUser()->Id;
		}
		
		$artistInsideModel->UpdateBy = self::getCurrentUser()->Id;
		$artistInsideModel->UpdateTime  = new \DateTime();
		
		
		$data = new ArtistInsideSecrecyData();
		return $data->addArtistInside($artistInsideModel);
		
		self::saveOperateHistory($funcCode, $artistInsideModel->toArray(true,true));
	}
	
	
}